package com.tanhua.manager.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.manager.domain.AnalysisByDay;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface AnalysisByDayMapper extends BaseMapper<AnalysisByDay> {
    @Select("select sum(num_registered)  from tb_analysis_by_day")
    Long queryCumulativeUsers();

    @Select(" select sum(num_active)  from tb_analysis_by_day where record_date<=#{todayStr} and  record_date>=#{beforeNDay}")
    Long queryActivePass(@Param("todayStr") String todayStr,@Param("beforeNDay") String beforeNDay);



    //    查询的是某一天登录人数或者注册人数
    @Select("select num_registered from tb_analysis_by_day  where record_date=#{logTime}")
    Integer queryNumRegisteredOrLogin(String logTime);

    //    查询某一天的活跃人数
    @Select("select num_active from tb_analysis_by_day  where record_date=#{logTime}")
    Integer queryNumActive(String logTime);

    @Select("select num_retention1d from tb_analysis_by_day  where record_date=#{logTime}")
    Integer queryNumRetention1d(String logTime);
}
